 <template>
      <a-spin :spinning="confirmLoading">
<!--        <a-card  title="四川大学华西医院" :headStyle="{'text-align':'center'}">-->
<!--        </a-card>-->
<!--        <a-card title="处方笺" :headStyle="{'text-align':'center','height':'18px'}"-->
<!--                :bodyStyle="{' overflow-y':'scroll'}" :size="boStyle" >-->
<!--          <a-card-->
<!--                  :bodyStyle="{' overflow-y':'scroll'}" >-->
          <div class="po-flex">
            <div style="flex: 22">
              <div class="po-flex-div" style=" margin-top: 0px;margin-bottom: 0px;">
                <p style="margin-bottom: 0px;">门诊号：{{Detail.patientId}}</p>
                <p style="margin-bottom: 0px;">科室：{{Detail.dept}}</p>
                <p style="margin-bottom: 0px;">医师：{{Detail.doc}}</p>
              </div>
              <div class="po-flex-div" style=" margin-top: 0px;margin-bottom: 0px;">
                <p style="margin-bottom: 0px;">姓名：{{Detail.name}}</p>
                <p style="margin-bottom: 0px;">性别：{{Detail.sex == 1 ? '男': '女'}}</p>
                <p style="margin-bottom: 0px;">年龄：{{parseInt(Detail.age)}} 岁</p>
                <p style="margin-bottom: 0px;flex: 2">处方号：{{Detail.prescNo}}</p>
              </div>
              <div class="po-flex-div" style=" margin-top: 0px;margin-bottom: 0px;">
                <p style="margin-bottom: 0px;">临床诊断：{{Detail.diagnosis}}</p>
              </div>
              <div class="po-flex-div" style=" margin-top: 0px;margin-bottom: 0px;">
                <p style="margin-bottom: 0px;">R.</p>
              </div>
              <div class = "list">
                <div v-for="item in detailData">
                  <div class="po-flex-div" style=" margin-top: 0px;margin-bottom: 0px;">
                    <p style="flex: 3;text-indent: 2rem;margin-bottom: 0px;">{{item.drug}} </p>
                    <p style="margin-bottom: 0px;text-align: right">{{item.quantity}}</p>
                  </div>
                  <div class="po-flex-div" style=" margin-top: 0px;margin-bottom: 0px;">
                    <p style="text-indent: 4rem;margin-bottom: 0px;">Sig:{{item.unit == '适量' ? '' : item.dosage }} {{item.unit}} {{item.frequency}}
                      {{item.route}}</p>
                  </div>
                </div>
              </div>
            </div>
          </div>
<!--        </a-card>-->


      </a-spin>
  </template>

  <script>
    import { getAction1, postActionparams1,postActionparams2, getAction2, getAction, postAction } from '@/api/manage'
    import {httpAction} from '@/api/manage'
    import DetailList from '@/components/tools/DetailList'
    const DetailListItem = DetailList.Item

    export default {
      name: 'SplitPanelAModal',
      components: {
        DetailList,
        DetailListItem
      },
      props:['CFdata'],
      data() {
        return {
          title: '处方',
          visible: false,
          formData: {},
          model: {},
          boStyle:{
            padding: "0",
            height:(window.innerHeight-350)+"px"
          },
          detailData: [],
          noTitleKey: '1',
          tabListNoTitle: [
            {
              key: '1',
              tab: '初评'
            },
            {
              key: '2',
              tab: '科室内评审'
            },
            {
              key: '3',
              tab: '点评会'
            }
          ],
          layout: {
            labelCol: { span: 3 },
            wrapperCol: { span: 14 }
          },
          labelCol: {
            xs: { span: 24 },
            sm: { span: 3 }
          },
          Detail:{},
          loadGoodsData:[],
          wrapperCol: {
            xs: { span: 24 },
            sm: { span: 16 }
          },
          confirmLoading: false,
          form: this.$form.createForm(this),
          goodsColumns: [
            {
              title: '通用名',
              dataIndex: 'drug',
              key: 'drug'
            },
            {
              title: '途径',
              dataIndex: 'route',
              key: 'route'
            },
            {
              title: '剂量',
              dataIndex: 'dosage',
              customRender:function(t, r, index) {
                return r.dosage + r.unit
              }
            },
            {
              title: '溶媒',
              dataIndex: 'menstruum',
              key: 'menstruum',
            },
            {
              title: '频次',
              dataIndex: 'frequency',
              key: 'frequency'
            },
            {
              title: '用药目的',
              dataIndex: 'objective',
              key: 'objective',
            },
          ],
          url: {
            add: '/test/jeecgDemo/add',
            edit: '/test/jeecgDemo/edit',
            detail: '/test/jeecgDemo/edit'
          }
        }
      },
      created() {
        this.model = {prescNo :  this.CFdata.prescNo }
        this.Detail = this.CFdata
              httpAction("/precs/getInfo", this.model, "post")
                .then(res => {
                  if (res.success) {
                    this.detailData = res.result
                    console.log( this.detailData)
                  } else {
                  }
                })

        this.visible = true
      },
      methods: {
        add() {
          this.edit({})
        },
        edit(record) {
          this.model = Object.assign({}, record)
          this.visible = true
        },
        detail(record) {
          this.model = Object.assign({}, record)
          this.Detail = this.model
          this.visible = true
          this.getDetail();
        },
        close() {
          //   this.$refs.form.resetFields()
          this.$emit('close')
          this.visible = false
        },
        handleOk() {
          console.log("aaaa1111")
          console.log(this.Detail.id)
          this.$refs.a1.add(this.Detail.id)
          //   const that = this
          //   // 触发表单验证
          //   this.$refs.form.validate(valid => {
          //     if (valid) {
          //       that.confirmLoading = true
          //       let httpurl = ''
          //       let method = ''
          //       if (!this.model.id) {
          //         httpurl += this.url.add
          //         method = 'post'
          //       } else {
          //         httpurl += this.url.edit
          //         method = 'put'
          //       }
          //       httpAction(httpurl, this.model, method)
          //         .then(res => {
          //           if (res.success) {
          //             that.$message.success(res.message)
          //             that.$emit('ok')
          //           } else {
          //             that.$message.warning(res.message)
          //           }
          //         })
          //         .finally(() => {
          //           that.confirmLoading = false
          //           that.close()
          //         })
          //     }
          //   })
          this.ModalText = '提交审核中'
          this.confirmLoading = true
          setTimeout(() => {
            this.visible = false
            this.confirmLoading = false
          }, 2000)
        },
        handleTabChange (key, type) {
          this[type] = key
        },
        getDetail() {
          let that = this
          var param = {
            id : this.model.id
            // pageNo: that.ipagination.current,
            // pageSize: that.ipagination.pageSize,
          }
          // postActionparams2('/perioperative/getDetail', param)
          //   .then((res) => {
          //     console.log(res)
          //     if (res.code == 0) {
          //       //that.Detail = res.result
          //
          //       that.loadGoodsData = this.getDruglist(res.result)
          //       that.Detail.incisionHeal = this.getIncisionHeal()
          //       that.Detail.incisionType = this.getIncisionType()
          //       that.Detail.opportunity = this.getOpportunity()
          //     }
          //   })
        },
        getDruglist(list) {
          var newlist =[]
          for(let item of list ){
            if (item.objective == '0') {
              item.objective = '预防'
            }
            if (item.objective  == '1') {
              item.objective = '治疗'
            }
            if (item.objective  == '2') {
              item.objective = '预+治'
            }
            if (item.objective  == '3') {
              item.objective = '无指证'
            }
            newlist.push(item)
          }

          return newlist
        },

        getOpportunity() {
          if (this.Detail.opportunity == '0') {
            return '<30min'
          }
          if (this.Detail.opportunity  == '1') {
            return '30min≤and≤1h'
          }
          if (this.Detail.opportunity  == '2') {
            return '>1h'
          }
          if (this.Detail.opportunity  == '3') {
            return '未用'
          }
          return ''
        },
        getIncisionType() {
          if (this.Detail.incisionType == '0') {
            return 'I'
          }
          if (this.Detail.incisionType  == '1') {
            return 'II'
          }
          if (this.Detail.incisionType  == '2') {
            return 'III'
          }
          return ''
        },
        getIncisionHeal() {
          if (this.Detail.incisionHeal == '0') {
            return '甲'
          }
          if (this.Detail.incisionHeal  == '1') {
            return '乙'
          }
          if (this.Detail.incisionHeal  == '2') {
            return '丙'
          }
          return ''
        },
        handleCancel() {
          this.close()
        }
      }
    }
  </script>

  <style scoped>
    .po-flex {
      display: flex;
    }
    .list {
      overflow-y: auto;
    }
    .card-div {
      flex: 20;
      border: 1px solid gainsboro;
    }

    .card-left-div p {
      line-height: 40px;
      height: 40px;
      font-size: 28px;
      text-align: center
    }

    .po-flex-div {
      display: flex;
      margin: 2px 0
    }

    .po-flex-div p {
      flex: 1;
      line-height: 35px;
      font-size: 16px
    }

    .right-div p {
      writing-mode: tb-rl;
      float: right;
      font-size: 16px
    }
  </style>
